package com.tbynet.jwp.repository.spi;

import java.math.BigInteger;
import java.util.List;
import java.util.Map;

import com.tbynet.jwp.framework.core._JwpService;
import com.tbynet.jwp.model.TermRelationships;

/**
 * 分类关系服务接口 - 扩展版
 */
public interface TermRelationshipService extends _JwpService<TermRelationships> {

    // 基本CRUD操作
    boolean saveTermRelationship(Object objectId, Object termTaxonomyId);
    boolean saveTermRelationship(Object objectId, Object termTaxonomyId, Integer termOrder);
    boolean updateTermOrder(Object objectId, Object termTaxonomyId, Integer termOrder);
    boolean deletePostTermRelationships(Object objectId, String taxonomy);
    boolean deleteByCompositeKey(Object objectId, Object termTaxonomyId);

    // 复合主键查询
    TermRelationships getByCompositeKey(Object objectId, Object termTaxonomyId);
    boolean existsByCompositeKey(Object objectId, Object termTaxonomyId);

    // 批量操作
    int batchSaveTermRelationships(List<Map<String, Object>> relationships);
    int batchDeleteByObjectId(Object objectId);

    // 查询方法
    List<TermRelationships> getByObjectId(Object objectId);
    List<TermRelationships> getByTermTaxonomyId(Object termTaxonomyId);
    List<BigInteger> getTermTaxonomyIdsByObjectId(Object objectId);
    long countByTermTaxonomyId(Object termTaxonomyId);
}